Skip to content

Conversation

@gkodinov
Copy link
Member

@gkodinov gkodinov commented Jan 9, 2026

Fix the warnings issued by a normal MacOSX compile.

Problems:

  1. sprintf is deprecated in favor of snprintf
  2. bison incorrectly issues a warning when it sees "b4_bin"
  3. MacOSX linker issues a warning about duplicate mysys/dbug/etc libraries.

On 1: replaced the relevant sprintf with snprintf. On 2: worked around by adding a compiler define with a different name
aliasing the character set variable used with a name that
won't trigger the bison warning
On 3: This is due to the fact that there's a circular dependecy between
mysys and dbug (among others). Turned the warning off by adding a macro
to suppress the duplicate library warning.
Applied the macro to all targets that have a dependency on
the mysys/dbug/strings libraries

@gkodinov gkodinov added the MariaDB Foundation Pull requests created by MariaDB Foundation label Jan 9, 2026
@gkodinov gkodinov requested a review from vaintroub January 9, 2026 13:00
@gkodinov gkodinov requested a review from vaintroub January 9, 2026 13:39
Copy link
Contributor

@dr-m dr-m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason why we are not working around the Bison bug in the earliest maintained branch (10.6)?

@gkodinov gkodinov force-pushed the bb-main-mdev38499 branch 2 times, most recently from 4b02673 to 9ea7208 Compare January 13, 2026 09:43
@dr-m
Copy link
Contributor

dr-m commented Jan 13, 2026

I am sad to see that my experimental change 615340f in #3616 to violite.h has not been included. As I noted back then, it only suppressed a number of deprecation warnings for the use of the unsafe and obsolete sprintf function, which had been superceded by snprintf in ISO/IEC 9899:1999 (C99). Some use of that function still remains here. I’d like to see a follow-up ticket to be filed to address this.

 compiling mariadb from a git tree

Fixed sprintf deprecation warnings compiling on MacOSX.

Replaced some sprintf calls with equivalent snprintf calls,
enough so that "normal" compile on MacOSX (as documented
in the docs) completes without warnings.
Copy link
Member

@vaintroub vaintroub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some formatting and comment nitpicks

if (!srv_read_only_mode) {
if (srv_innodb_status) {

const size_t len = strlen(fil_path_to_mysql_datadir) +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly weird indentation here, inconsistent with existing code. Can you align with what was here before (spaces? tabs? mix ? ), so it looks good in the github online page, too?

(IF_WIN(GetCurrentProcessId(), getpid())));
ut_malloc_nokey(len));

snprintf(srv_monitor_file_name,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a lot of whitespace changes here. I think one line would work well, if you change sprintf to snprintf, and add , len at the end of the same line. Or on a new line, if you want, with indentation consistent with other parameters. But can the rest of parameters remain intact?

sprintf(to, "%08lx%08lx", hash_res[0], hash_res[1]);
/*
we assume that to has at least 17 bytes allocated:
2 ulongs in hex + NUL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"2 hexadecimals numbers, 8 bytes each + NUL"
That they are ulong, is non-essential (and also unnecessary, better if they used a more portable type)
But that they are 8 byte long, is essential.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MariaDB Foundation Pull requests created by MariaDB Foundation

Development

Successfully merging this pull request may close these issues.

5 participants